The present invention relates to computer graphics, and more particularly to interactive graphics systems such as home video game platforms. More particularly, this invention relates to a graphics processing improvement that uses a lighting function to produce a parameter for subsequent use in changing a color or opacity. Still more particularly, the invention relates to a 3D graphics system wherein a lighting calculation defines a parameter such as distance or angle that is applied to a further function (e.g., texturing).
Many of us have seen films containing remarkably realistic dinosaurs, aliens, animated toys and other fanciful creatures. Such animations are made possible by computer graphics. Using such techniques, a computer graphics artist can specify how each object should look and how it should change in appearance over time, and a computer then models the objects and displays them on a display such as your television or a computer screen. The computer takes care of performing the many tasks required to make sure that each part of the displayed image is colored and shaped just right based on the position and orientation of each object in a scene, the direction in which light seems to strike each object, the surface texture of each object, and other factors.
Because computer graphics generation is complex, computer-generated three-dimensional graphics just a few years ago were mostly limited to expensive specialized flight simulators, high-end graphics workstations and supercomputers. The public saw some of the images generated by these computer systems in movies and expensive television advertisements, but most of us couldn""t actually interact with the computers doing the graphics generation. All this has changed with the availability of relatively inexpensive 3D graphics platforms such as, for example, the Nintendo 64(copyright) and various 3D graphics cards now available for personal computers. It is now possible to interact with exciting 3D animations and simulations on relatively inexpensive computer graphics systems in your home or office.
It has long been known to perform lighting calculations in a 3-D graphics systems based on a variety of parameters (e.g., distance attenuation, angle, beam lighting, etc.). Traditionally, the results of such lighting calculations were used to modify the color and/or opacity of the object being displayedxe2x80x94as is documented in a variety of standard reference materials on computer graphics (see for example, Foley et al, Computer Graphics Principles and Practice (2d. Ed. 1990) at Chapter 16 (xe2x80x9cIllumination and Shadingxe2x80x9d); and Moller et al, Real Time Rendering (A K Peters 1999) at Section 4.3 et seq. (xe2x80x9cLighting and Shadingxe2x80x9d); Rogers et al, Procedural Elements for Computer Graphics (2d Ed. McGraw-Hill 1997) at Section 5.2 et. seq. (xe2x80x9cIllumination Modelsxe2x80x9d); Neider et al, OpenGL Programming Guide (Addison-Wesley 1993) at Chapter 6 (xe2x80x9cLightingxe2x80x9d); and Kovach, Inside Direct3D (Microsoft Press 2000) at Chapter 5 (xe2x80x9cDirect3D Vertices and the Transformation and Lighting Pipelinexe2x80x9d). For example, techniques known as Gouraud shading and Phong shading modify the color of a displayed surface depending on a lighting effect modeled by a lighting equation. As one example, shining a bright spotlight on a shiny surface can have the effect of whitening the surface color at points where the light is shining. This is often accomplished in a conventional graphics system by having the rasterizer determine the color of each pixel of the displayed surface of a primitive based on the primitive""s color (often defined on a vertex-by-vertex basis) and on the result of the lighting equation(s).
A problem graphics system designers confronted in the past was how to efficiently create non-photorealistic images such as cartoon characters. For many years, most of the work in the graphics field was devoted to creating images that are as realistic as photographs. More recently, however, there has been an interest in non-photorealistic imaging.
One type of non-photorealistic imaging that has recently generated interest is the process of automating the imaging of cartoon characters. During the heyday of hand drawn cartooning in the 1930s and 1940s, artists created wonderful cartoon characters that dynamically changed from frame to frame. These hand drawn cartoons in many ways set the standard for cartoon rendering. The cartoons were not intended to appear realistic. To the contrary, the cartoons were designed to appear as caricatures. For example, in such cartoons, a person""s face might appear to be pasty white with rosy red cheeks defined by brilliantly red or reddish-pink coloration. As the character moved through the scene, the cheek coloration might change dynamically as the artist hand-colored each frame. Such dynamic effects are fascinating to watch and add interest to the cartoon images.
Unfortunately, the hand-drawn cartoon artistry of the 1930s and 1940s was very time consuming and expensive. Moreover, people now want to use video and computer games to interact with cartoon characters. While video games have for a number of years been successful in dynamically rendering cartoon characters interactively, they have never achieved the hand-drawn artistry details of latter-day hand-drawn cartoons. While much work has been done on high end type systems for authoring cartoon and other non-photorealistic images, further improvements are possible and desirable.
The present invention provides improvements in non-photorealistic and other imaging effects that can be implemented using a low cost graphics system such as, for example, a home video game platform or a personal computer graphics accelerator.
In accordance with one aspect provided by this invention, the lighting function of the type typically used to light objects within a scene is used to produce a parameter other than color. Such a parameter is used to modify a color or opacity of an object.
In accordance with another aspect provided by this invention, a lighting calculation performs per-vertex lighting to provide conventional color component outputs. The color component outputs are applied to a texturing function that processes the color components as achromatic parameters. The texturing function output provides a visualization effect (e.g., color and/or opacity modified based on the achromatic parameters) that is used to contribute to the visualization of a rendered scene.
In accordance with yet another aspect provided by this invention, the lighting calculation output provides three color components one of which is discarded. The other two color components are converted into texture coordinates and used in a texture mapping operation. One of the texture coordinates selects a one-dimensional texture map within a two-dimensional table. The other texture coordinate selects a particular texel within the selected one-dimensional texture map. The resulting selected texel provides color and/or alpha information that is applied to a surface defined by the vertex.
In accordance with yet another aspect provided by this invention, non-photorealistic cartoon lighting effects are provided in a real time 3D graphics system by using a lighting calculation to produce a parameter other than color or opacity. A one-dimensional texture map can be defined specifying different brush strokes as a function of the parameter. A conventional texture mapping operation can be used to map the one-dimensional texture map onto a polygon surface based on the parameter.
In more detail, the disclosed system can provide conventional lighting-based shading (as discussed above) as part of its overall operation, but provides an additional enhancement that allows the lighting equation(s) to generate a texture coordinate (i.e., a parameter other than color or opacity). That other parameter may be inputted to a further function (e.g., a lookup table stored as a texture) to provide a further resultxe2x80x94which may in turn change the color/opacity of an object. This intermediate step of, having the lighting calculation produce a parameter that only indirectly affects color and/or opacity of a displayed object provides additional flexibility beyond conventional approaches that use the lighting equation output to directly affect primitive surface color.
A particular example embodiment uses the lighting equation result to select a one-dimensional texture from a number of textures. As an example, to display a tree trunk you might define two different one-dimensional texturesxe2x80x94one having a range of silvers and the other having a range of browns. The lighting equation could be used to determine the angle at which a light source is striking the tree trunk, with the result selecting between the two textures. The tree trunk could be colored (using conventional texture mapping) with a range of different silvers from an oblique angle but with a range of browns/blacks when the light is striking it head-on. In such a case, the lighting equation selects a one-dimensional texture (i.e., it is acting as a parameter other than color or opacityxe2x80x94in this particular example, selecting between two different textures).
In the particular embodiment disclosed herein, improvements are made to the transformation and lighting (xe2x80x9cT and Lxe2x80x9d) pipeline to allow it to generate a texture coordinate(s) based on the lighting equation. The transformation and lighting develops the lighting equation output, but instead of providing it directly to change the pixel color/opacity generated by the rasterizer, it provides the result as a texture coordinate to a texture unit. In the disclosed embodiment, the output of the texture unit is a color or opacity that is blended with the object""s primitive color/opacity (e.g., as developed by transform and lighting pipeline and the rasterizer in a conventional fashion based on the same or different lighting equation using a conventional shading algorithm such as Gouraud or Phong shading) to provide a modified color/opacity value for display.